inherited frmOperationCreate: TfrmOperationCreate
  Left = 375
  Top = 250
  Width = 522
  Height = 336
  Caption = #1057#1086#1079#1076#1072#1085#1080#1077' '#1086#1087#1077#1088#1072#1094#1080#1080
  OldCreateOrder = True
  OnShow = FormShow
  PixelsPerInch = 96
  TextHeight = 13
  inherited Panel1: TPanel
    Top = 282
    Width = 514
    inherited BitBtn1: TBitBtn
      Left = 307
    end
    inherited BitBtn2: TBitBtn
      Left = 409
    end
  end
  inherited ToolBar1: TToolBar
    Width = 514
    Height = 0
  end
  object gbAbonent: TGroupBox [2]
    Left = 0
    Top = 0
    Width = 514
    Height = 92
    Align = alTop
    Caption = ' '#1044#1086#1075#1086#1074#1086#1088' '
    TabOrder = 2
    object Label1: TLabel
      Left = 10
      Top = 19
      Width = 90
      Height = 13
      Alignment = taRightJustify
      AutoSize = False
      Caption = #8470' '#1083#1080#1094'. '#1089#1095#1077#1090#1072
    end
    object Label2: TLabel
      Left = 242
      Top = 19
      Width = 33
      Height = 13
      Alignment = taRightJustify
      AutoSize = False
      Caption = #1060#1048#1054
    end
    object Label3: TLabel
      Left = 10
      Top = 43
      Width = 90
      Height = 13
      Alignment = taRightJustify
      AutoSize = False
      Caption = #1040#1076#1088#1077#1089
    end
    object Label7: TLabel
      Left = 10
      Top = 66
      Width = 90
      Height = 13
      Alignment = taRightJustify
      AutoSize = False
      Caption = #1059#1089#1083#1091#1075#1072
    end
    object dbeNLS: TDBEditEh
      Left = 106
      Top = 16
      Width = 121
      Height = 19
      TabStop = False
      AlwaysShowBorder = True
      Color = clBtnFace
      DataField = 'G_LICSCHET'
      DataSource = dscDogovor
      EditButtons = <>
      Flat = True
      ReadOnly = True
      TabOrder = 0
      Visible = True
    end
    object dbeName: TDBEditEh
      Left = 278
      Top = 16
      Width = 218
      Height = 19
      TabStop = False
      AlwaysShowBorder = True
      Color = clBtnFace
      DataField = 'NAME'
      DataSource = dscDogovor
      EditButtons = <>
      Flat = True
      ReadOnly = True
      TabOrder = 1
      Visible = True
    end
    object dbeAddress: TDBEditEh
      Left = 106
      Top = 40
      Width = 390
      Height = 19
      TabStop = False
      AlwaysShowBorder = True
      Color = clBtnFace
      DataField = 'ADDRESS'
      DataSource = dscDogovor
      EditButtons = <>
      Flat = True
      ReadOnly = True
      TabOrder = 2
      Visible = True
    end
    object dbeService: TDBEditEh
      Left = 106
      Top = 64
      Width = 390
      Height = 19
      TabStop = False
      Alignment = taLeftJustify
      AlwaysShowBorder = True
      Color = clBtnFace
      DataField = 'SERVICE'
      DataSource = dscDogovor
      EditButtons = <>
      Flat = True
      ReadOnly = True
      TabOrder = 3
      Visible = True
    end
  end
  object GroupBox1: TGroupBox [3]
    Left = 0
    Top = 92
    Width = 514
    Height = 190
    Align = alClient
    Caption = ' '#1054#1087#1077#1088#1072#1094#1080#1103' '
    TabOrder = 3
    object Label8: TLabel
      Left = 10
      Top = 18
      Width = 90
      Height = 13
      Alignment = taRightJustify
      AutoSize = False
      Caption = #1058#1080#1087' '#1086#1087#1077#1088#1072#1094#1080#1080
    end
    object Label10: TLabel
      Left = 10
      Top = 42
      Width = 90
      Height = 13
      Alignment = taRightJustify
      AutoSize = False
      Caption = #1055#1077#1088#1080#1086#1076' '#1086#1087#1077#1088#1072#1094#1080#1080
    end
    object Label12: TLabel
      Left = 10
      Top = 66
      Width = 90
      Height = 13
      Alignment = taRightJustify
      AutoSize = False
      Caption = #1044#1072#1090#1072' '#1086#1087#1077#1088#1072#1094#1080#1080
    end
    object Label9: TLabel
      Left = 10
      Top = 90
      Width = 90
      Height = 13
      Alignment = taRightJustify
      AutoSize = False
      Caption = #1057#1091#1084#1084#1072
    end
    object Label4: TLabel
      Left = 10
      Top = 114
      Width = 90
      Height = 13
      Alignment = taRightJustify
      AutoSize = False
      Caption = #1050#1086#1084#1084#1077#1085#1090#1072#1088#1080#1081
    end
    object Label5: TLabel
      Left = 10
      Top = 138
      Width = 90
      Height = 13
      Alignment = taRightJustify
      AutoSize = False
      Caption = #1053#1072#1079#1085#1072#1095#1077#1085#1080#1077
    end
    object Label6: TLabel
      Left = 10
      Top = 162
      Width = 90
      Height = 13
      Alignment = taRightJustify
      AutoSize = False
      Caption = #1040#1075#1077#1085#1090
    end
    object lcbOperType: TDBLookupComboboxEh
      Left = 106
      Top = 16
      Width = 390
      Height = 19
      TabStop = False
      Alignment = taLeftJustify
      AlwaysShowBorder = True
      EditButtons = <>
      Flat = True
      KeyField = 'ID'
      ListField = 'PAY_NAME'
      ListSource = dscPayTypes
      TabOrder = 0
      Visible = True
    end
    object dbdteBDate: TDBDateTimeEditEh
      Left = 106
      Top = 40
      Width = 80
      Height = 19
      Alignment = taLeftJustify
      AlwaysShowBorder = True
      EditButtons = <>
      Flat = True
      Kind = dtkDateEh
      TabOrder = 1
      Visible = True
    end
    object dbdteEDate: TDBDateTimeEditEh
      Left = 190
      Top = 40
      Width = 80
      Height = 19
      Alignment = taLeftJustify
      AlwaysShowBorder = True
      EditButtons = <>
      Flat = True
      Kind = dtkDateEh
      TabOrder = 2
      Visible = True
    end
    object dbdteDocDate: TDBDateTimeEditEh
      Left = 106
      Top = 64
      Width = 80
      Height = 19
      TabStop = False
      Alignment = taLeftJustify
      AlwaysShowBorder = True
      EditButtons = <>
      Flat = True
      Kind = dtkDateEh
      TabOrder = 3
      Visible = True
    end
    object dbeNote: TDBEditEh
      Left = 106
      Top = 112
      Width = 390
      Height = 19
      TabStop = False
      Alignment = taLeftJustify
      AlwaysShowBorder = True
      EditButtons = <>
      Flat = True
      TabOrder = 4
      Visible = True
    end
    object lcbReason: TDBLookupComboboxEh
      Left = 106
      Top = 136
      Width = 390
      Height = 19
      TabStop = False
      Alignment = taLeftJustify
      AlwaysShowBorder = True
      EditButtons = <>
      Flat = True
      KeyField = 'CODE'
      ListField = 'NAME'
      ListSource = dscReason
      TabOrder = 5
      Visible = True
    end
    object dbeSumma: TDBNumberEditEh
      Left = 106
      Top = 88
      Width = 80
      Height = 19
      AlwaysShowBorder = True
      currency = False
      EditButtons = <>
      Flat = True
      TabOrder = 6
      Visible = True
    end
    object lcbAgent: TDBLookupComboboxEh
      Left = 106
      Top = 160
      Width = 390
      Height = 19
      TabStop = False
      Alignment = taLeftJustify
      AlwaysShowBorder = True
      EditButtons = <>
      Flat = True
      KeyField = 'ID'
      ListField = 'AGENT_NAME'
      ListSource = dscAgents
      TabOrder = 7
      Visible = True
    end
  end
  inherited ActionList1: TActionList
    Left = 334
    Top = 10
    inherited aSave: TAction
      OnExecute = aSaveExecute
    end
    inherited aCancel: TAction
      OnExecute = aCancelExecute
    end
  end
  object dsDogovor: TpFIBDataSet
    UpdateSQL.Strings = (
      'UPDATE PAYS'
      'SET '
      '    P_TYPE = :P_TYPE,'
      '    BDATE = :BDATE,'
      '    EDATE = :EDATE,'
      '    METER_ID = :METER_ID,'
      '    PH_OLD = :PH_OLD,'
      '    PH = :PH,'
      '    REESTR = :REESTR,'
      '    NOTE = :NOTE,'
      '    CHECKED = :CHECKED'
      'WHERE'
      '    ID = :OLD_ID'
      '    ')
    RefreshSQL.Strings = (
      'select v.address, v.name, v.g_licschet, s.name as service,'
      
        '       p.id, p.p_type, p.dogovor_id, p.docdate, p.docno, p.bdate' +
        ', p.edate,'
      '       p.summa, p.summ_all, p.summ_norm,'
      '       (select sum(ge.givensumma) from given_exempts ge'
      '          where ge.pay_id = p.id) as summ_exempts,'
      
        '       (select rname from user_getfullname (p.createuserid)) as ' +
        'createuser,'
      '       p.createdate,'
      
        '       (select rname from user_getfullname (p.modifyuserid)) as ' +
        'modifyuser,'
      '       p.modifydate,'
      '       p.meter_id, p.ph_old, p.ph, p.paidcount, p.calcph,'
      '       p.reestr, p.note, p.checked,'
      '       (case when p.tariff_id > 0'
      '        then (select r.tariff from rtariffs r'
      '               where r.id = p.tariff_id)'
      '        else (select r.tariff from dogovor_tariffs r'
      '               where r.id = -p.tariff_id) end) as tariff'
      ''
      '  from pays p, dogovors d, v_abons v, services s'
      '  where(  s.id = d.service_id'
      '    and d.id = p.dogovor_id'
      '    and v.id = d.abonent_id'
      '    and p.id = :ppay_id )'
      '    and (     P.ID = :OLD_ID'
      '     )'
      '    ')
    SelectSQL.Strings = (
      'select a.g_licschet, a.address, a.name, s.name as service'
      'from dogovors d'
      '  join v_abons a on a.id = d.abonent_id'
      '  join services s on s.id = d.service_id'
      'where d.id = :dogovor_id')
    AllowedUpdateKinds = []
    Transaction = MAINDM.pMainTransaction
    Database = MAINDM.pMainDatabase
    Left = 374
    Top = 10
    poSQLINT64ToBCD = True
  end
  object dscDogovor: TDataSource
    DataSet = dsDogovor
    Left = 410
    Top = 10
  end
  object dsPayTypes: TpFIBDataSet
    UpdateSQL.Strings = (
      'UPDATE PAYS'
      'SET '
      '    P_TYPE = :P_TYPE,'
      '    BDATE = :BDATE,'
      '    EDATE = :EDATE,'
      '    METER_ID = :METER_ID,'
      '    PH_OLD = :PH_OLD,'
      '    PH = :PH,'
      '    REESTR = :REESTR,'
      '    NOTE = :NOTE,'
      '    CHECKED = :CHECKED'
      'WHERE'
      '    ID = :OLD_ID'
      '    ')
    RefreshSQL.Strings = (
      'select v.address, v.name, v.g_licschet, s.name as service,'
      
        '       p.id, p.p_type, p.dogovor_id, p.docdate, p.docno, p.bdate' +
        ', p.edate,'
      '       p.summa, p.summ_all, p.summ_norm,'
      '       (select sum(ge.givensumma) from given_exempts ge'
      '          where ge.pay_id = p.id) as summ_exempts,'
      
        '       (select rname from user_getfullname (p.createuserid)) as ' +
        'createuser,'
      '       p.createdate,'
      
        '       (select rname from user_getfullname (p.modifyuserid)) as ' +
        'modifyuser,'
      '       p.modifydate,'
      '       p.meter_id, p.ph_old, p.ph, p.paidcount, p.calcph,'
      '       p.reestr, p.note, p.checked,'
      '       (case when p.tariff_id > 0'
      '        then (select r.tariff from rtariffs r'
      '               where r.id = p.tariff_id)'
      '        else (select r.tariff from dogovor_tariffs r'
      '               where r.id = -p.tariff_id) end) as tariff'
      ''
      '  from pays p, dogovors d, v_abons v, services s'
      '  where(  s.id = d.service_id'
      '    and d.id = p.dogovor_id'
      '    and v.id = d.abonent_id'
      '    and p.id = :ppay_id )'
      '    and (     P.ID = :OLD_ID'
      '     )'
      '    ')
    SelectSQL.Strings = (
      'select p.id, p.pay_name from pay_types p where p.can_manual = 1')
    AfterScroll = dsPayTypesAfterScroll
    AllowedUpdateKinds = []
    Transaction = MAINDM.pMainTransaction
    Database = MAINDM.pMainDatabase
    Left = 374
    Top = 38
    poSQLINT64ToBCD = True
    object dsPayTypesID: TFIBIntegerField
      FieldName = 'ID'
    end
    object dsPayTypesPAY_NAME: TFIBStringField
      FieldName = 'PAY_NAME'
      Size = 120
      EmptyStrToNull = True
    end
  end
  object dscPayTypes: TDataSource
    DataSet = dsPayTypes
    Left = 410
    Top = 38
  end
  object dsReason: TpFIBDataSet
    UpdateSQL.Strings = (
      'UPDATE PAYS'
      'SET '
      '    P_TYPE = :P_TYPE,'
      '    BDATE = :BDATE,'
      '    EDATE = :EDATE,'
      '    METER_ID = :METER_ID,'
      '    PH_OLD = :PH_OLD,'
      '    PH = :PH,'
      '    REESTR = :REESTR,'
      '    NOTE = :NOTE,'
      '    CHECKED = :CHECKED'
      'WHERE'
      '    ID = :OLD_ID'
      '    ')
    RefreshSQL.Strings = (
      'select v.address, v.name, v.g_licschet, s.name as service,'
      
        '       p.id, p.p_type, p.dogovor_id, p.docdate, p.docno, p.bdate' +
        ', p.edate,'
      '       p.summa, p.summ_all, p.summ_norm,'
      '       (select sum(ge.givensumma) from given_exempts ge'
      '          where ge.pay_id = p.id) as summ_exempts,'
      
        '       (select rname from user_getfullname (p.createuserid)) as ' +
        'createuser,'
      '       p.createdate,'
      
        '       (select rname from user_getfullname (p.modifyuserid)) as ' +
        'modifyuser,'
      '       p.modifydate,'
      '       p.meter_id, p.ph_old, p.ph, p.paidcount, p.calcph,'
      '       p.reestr, p.note, p.checked,'
      '       (case when p.tariff_id > 0'
      '        then (select r.tariff from rtariffs r'
      '               where r.id = p.tariff_id)'
      '        else (select r.tariff from dogovor_tariffs r'
      '               where r.id = -p.tariff_id) end) as tariff'
      ''
      '  from pays p, dogovors d, v_abons v, services s'
      '  where(  s.id = d.service_id'
      '    and d.id = p.dogovor_id'
      '    and v.id = d.abonent_id'
      '    and p.id = :ppay_id )'
      '    and (     P.ID = :OLD_ID'
      '     )'
      '    ')
    SelectSQL.Strings = (
      'select rt.code, rt.name'
      'from rptarget rt'
      'where rt.p_type = :p_type')
    AllowedUpdateKinds = []
    Transaction = MAINDM.pMainTransaction
    Database = MAINDM.pMainDatabase
    Left = 374
    Top = 66
    poSQLINT64ToBCD = True
    object dsReasonCODE: TFIBIntegerField
      FieldName = 'CODE'
    end
    object dsReasonNAME: TFIBStringField
      FieldName = 'NAME'
      Size = 60
      EmptyStrToNull = True
    end
  end
  object dscReason: TDataSource
    DataSet = dsReason
    Left = 410
    Top = 66
  end
  object trSaveMaket: TpFIBTransaction
    DefaultDatabase = MAINDM.pMainDatabase
    TimeoutAction = TARollback
    Left = 380
    Top = 98
  end
  object dsSaveMaket: TpFIBDataSet
    SelectSQL.Strings = (
      
        'select 1 from PROC_INSERT_MAKETS (:dogovor_id,:p_type,:note,:sum' +
        'ma,:docdate,null,:pbdate,:pedate,null,:ptarget,:pagent,null,null' +
        ')')
    Transaction = trSaveMaket
    Database = MAINDM.pMainDatabase
    Left = 410
    Top = 96
  end
  object dsAgents: TpFIBDataSet
    SelectSQL.Strings = (
      'SELECT ID, AGENT_NAME'
      '  FROM AGENTS'
      '  where id > 0 '
      '  order by AGENT_NAME'
      '')
    Transaction = MAINDM.pMainTransaction
    Database = MAINDM.pMainDatabase
    Left = 272
    Top = 254
    poSQLINT64ToBCD = True
    oFetchAll = True
    object dsAgentsID: TFIBIntegerField
      FieldName = 'ID'
    end
    object dsAgentsAGENT_NAME: TFIBStringField
      FieldName = 'AGENT_NAME'
      Size = 120
      EmptyStrToNull = True
    end
  end
  object dscAgents: TDataSource
    DataSet = dsAgents
    Left = 304
    Top = 254
  end
end
